package com.yanqu.road.server.cmd.beautyescort;

import com.yanqu.road.pb.beautyescort.BeautyEscortProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.logic.MessageHelper;
import com.yanqu.road.server.manager.beautyescort.CrossBeautyEscortMgr;
import com.yanqu.road.server.manager.beautyescort.CrossEscortPlayerWrap;
import com.yanqu.road.utils.YanQuMessageUtils;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.Protocol;

import java.util.List;

@Cmd(code = Protocol.C_BEAUTY_ESCORT_GET_ESCORT_BEAUTY_LIST, desc = "已派遣美女（押镖中）")
public class CrossBeautyEscortGetEscortBeautyListCmd extends CrossCommand {

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        CrossEscortPlayerWrap escortPlayer = CrossBeautyEscortMgr.getEscortPlayer(serverId, packet.getPlayerId());
        if(escortPlayer != null){
            List<Integer> beautyIdList = escortPlayer.getEscortingBeautyIdList();
            BeautyEscortProto.BeautyEscortBeautyDartInfoRespMsg.Builder respMsg = BeautyEscortProto.BeautyEscortBeautyDartInfoRespMsg.newBuilder();
            respMsg.addAllBeauty(beautyIdList);
            MessageHelper.sendPacket(serverId, packet.getPlayerId(), YanQuMessageUtils.buildMessage(Protocol.U_BEAUTY_ESCORT_GET_ESCORT_BEAUTY_LIST, respMsg));
        }
    }

    @Override
    public void sendData() {

    }
}
